<template>
	<div class="code-layout">
		<div class="code-info">
			<ul class="info-item">
				<li>
					<span class="key">版本</span>
					<span class="commit">提交信息</span>
					<span class="val">创建时间</span>
				</li>
				<li v-for="item in modelAllVersions" :key="item.id">
					<span class="key">{{ item.version }}</span>
					<span class="commit">{{ item.commit_msg }}</span>
					<span class="val">{{ item.create_time }}</span>
					<el-button
						class="handle-btn"
						type="text"
						size="medium"
						@click="$router.push(`/model/code?id=${detailData.model_id}`)"
					>
						来源
					</el-button>
				</li>
			</ul>
		</div>
	</div>
</template>

<script>
import { getAllModelVersions } from "@/api/modelversion";

export default {
	props: ["detailData"],
	data() {
		return {
			modelAllVersions: [],
		};
	},
	mounted() {
		this.getAllModelVersion();
	},
	methods: {
		async getAllModelVersion() {
			let res = await getAllModelVersions({ model_id: this.detailData.model_id });
			this.modelAllVersions = res.data.slice(0, 9);
		},
	},
};
</script>

<style lang="less" scoped>
@import "~@/assets/css/code.less";
</style>
